'use strict';
exports.main = async (event, context) => {
  // event 为客户端上传的参数
  console.log('event : ', event);
  const db = uniCloud.database();
  const user = await db.collection('users').where({
	  userId:event.userId
	  }).get();

  // 在返回数据给客户端之前，将 openid 从结果中删除
  const usersWithoutOpenid = user.data.map(u => {
    const { openid, ...userData } = u;
    return userData;
  });

  // 返回经过处理后的数据给客户端
  return usersWithoutOpenid;
};
